using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Dao;
namespace Common
{
    public class ErrorManagement
    {
        public static void TrackLog(string errorMessage)
        {
            StackTrace _st = new StackTrace(true);
            string _stackIndent = "";
            string message = string.Empty;
            for (int i = 1; i < _st.FrameCount; i++)
            {
                StackFrame _sf = _st.GetFrame(i);
                string a = string.Format(_stackIndent + " Method: {0}",
                     _sf.GetMethod());
                string a1 = string.Format(_stackIndent + " File: {0}",
                     _sf.GetFileName());
                string a2 = string.Format(_stackIndent + " Line Number: {0}",
                     _sf.GetFileLineNumber());
                string a3 = string.Format(_stackIndent + " Desciption error: {0}",
                  errorMessage);
                string a4 = string.Format(_stackIndent + " Date time: {0}",
                 DateTime.Now);
                _stackIndent += "  ";

            }
            DataLog.Insert(message);
        }
    }
}
